package com.jiangnan.artstudio.fragment;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import com.jiangnan.artstudio.R;
import com.jiangnan.artstudio.adapter.ZhiRiAdapter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class CyglZhiR extends BaseFragment{

    private ListView listView;
    private List<Map<String,Object>> dataList;
    private ZhiRiAdapter adapter;

    private int[] iconHead={R.drawable.head4,R.drawable.head5,R.drawable.head6,R.drawable.head7,R.drawable.head8};
    private String[] names={"金泰亨","TOP","姜义健","赖冠霖","BOBY"};
    private String[] schools={"艺术设计152","艺术设计152","艺术设计152","艺术设计164","室内设计164"};

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.cygl_zhir,container,false);
        listView = view.findViewById(R.id.zhir_list);

        dataList=new ArrayList<>();
        adapter=new ZhiRiAdapter(getContext(),getData());
        listView.setAdapter(adapter);

        return view;
    }

    public List<Map<String,Object>> getData(){
        for(int i=0;i<names.length;i++){
            Map<String,Object>map=new HashMap<>();
            map.put("head",iconHead[i]);
            map.put("name",names[i]);
            map.put("school",schools[i]);
            dataList.add(map);
        }
        return dataList;
    }
}
